package aad.storyboard.controller;

import aad.storyboard.model.AnimationProvider;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;


/**
 * Command pattern: will be triggered if the WikiBackButton is clicked
 */
public class BackToMainViewNavigator implements NavigateCommand{

	private Activity activity;

	public BackToMainViewNavigator(Activity a)
	{
		activity=a;
	}
	
	

	@Override
	public void navigate() {	
		System.out.println("BackToNavigation clicked");
		View nextView = ControllerManager.getInstance().getGuiComposer().getMainView();
		if(nextView.getParent() != null){
			((ViewGroup)nextView.getParent()).removeView(nextView);
		}
		
		activity.setContentView(nextView);		
		AudioPlayer.getInstance().playAudio();
		//AnimationProvider.getInstance().unpauseAllAnimations();
		
	}

}
